use std::fs;
use std::process;

mod token;
mod ast;
mod scanner;
mod parser;

use scanner::Scanner;

fn main() {
    const PATH: &str = "test.c";
    let contents = fs::read_to_string(PATH).unwrap_or_else(|err| {
        println!("Read file error: {}", err);
        process::exit(1);
    });
    let mut scanner = Scanner::new(contents.as_str());
    let tokens = scanner.scan();
    println!("code lines: {}", scanner.line());
    for tk in tokens {
        println!("{}", tk);
    }
}
